/*
 * Copyright 2013 Rodrigo Villablanca <villa061004@gmail.com>.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cl.rvillablanca.jpatch.core;

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * His purpose is to deliver all path files of the new files in the difference.
 *
 * @author Rodrigo Villablanca <villa061004@gmail.com>
 * @since 1.0
 */
public class Differenciator {

    private static final Logger LOGGER = Logger.getLogger(Differenciator.class.getName());

    public List<Path> difference(String working, String base) throws IOException {
        LOGGER.log(Level.INFO, "Applying difference to base {0} and working {1}", new Object[]{base, working});
        Visitor visitor = new Visitor(Paths.get(working), Paths.get(base));
        visitor.fillList();
        LOGGER.log(Level.INFO, "Found files: {0}", visitor.getList().size());
        return visitor.getList();
    }
}
